Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add concurrency testing for storage operations #1132

Open
wants to merge 6 commits into
base: mutations/mutations
Choose a base branch
from

Conversation

josecorella
Copy link
Contributor

Issue #, if available:

Description of changes:

Squash/merge commit message, if applicable:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this doing here?
Is this temporary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is temporary. I wanted to add a barebones README for these tests

Copy link

@josecorella and @texastony, I noticed you are updating the smithy model files.
Does this update need new or updated user documentation?
Are you adding constraints inside list, map or union? Do you know about this issue: smithy-lang/smithy-dafny#491?

@josecorella josecorella force-pushed the test/concurrent-operations-storage branch from a9c2675 to b96c516 Compare December 17, 2024 21:52
@josecorella
Copy link
Contributor Author

force pushed due to rebase from mutations/mutations

@josecorella josecorella marked this pull request as ready for review December 17, 2024 23:01
@josecorella josecorella requested a review from a team as a code owner December 17, 2024 23:01
Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Awesome!
But there are some things I think we need to fix up before calling this done.

Also, right now, I cannot figure out if the new library_concurrency_tests.yml was run by GitHub CI here or not.

145 checks passed.
mutations/mutations has 142 checks.

So... maybe the new checks ran?
But I cannot figure out which of the 145 checks they are,
I think because their name is Library Interoperability Tests which conflicts with another GitHub workflow.

Comment on lines +1 to +2
# This workflow performs interoperability tests across the supported runtimes of the MPL.
name: Library Interoperability Tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: We need to fix this up.
Or else the Job will run under the wrong name.

]
# https://taskei.amazon.dev/tasks/CrypTool-5284
dotnet-version: ["6.0.x"]
java-versions: [8, 11, 16, 17]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking/comment: For my money, I would only test on Java 8 and Java 17.
Maybe even only Java 8.

I do not think the subject of these tests changes behavior under different Java versions.

# https://taskei.amazon.dev/tasks/CrypTool-5284
dotnet-version: ["6.0.x"]
java-versions: [8, 11, 16, 17]
runs-on: ${{ matrix.os }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking/question: Does the subject of these tests change behavior across OS-es?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, copy-pasta

with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2
role-session-name: InterOpTests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: not InterOpTests but Concurrency tests, right?

Copy link
Contributor Author

@josecorella josecorella Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup! just copy pasta-ying

}

val testConcurrentExamples = task<Test>("testConcurrentExamples") {
description = "Runs examples tests."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "Runs examples tests."
description = "Runs Concurrency tests."

Comment on lines +257 to +260
Assert.assertTrue(
(cancellationReason.code().equals("TransactionConflict") ||
cancellationReason.code().equals("None") ||
cancellationReason.code().equals("ConditionalCheckFailed"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert only fires if an Exception is thrown.

There is no assert on the non-catch path.

Also, there is no evidence if, in the 10 * 100 = 1000 invocations,
one of these asserts was met.

Comment on lines +288 to +301
@Test(
dependsOnMethods = {
"testConcurrentActiveReadWhileVersionInFlight",
"testConcurrentVersionWithStorage",
}
)
public void testVersionReads() {
Assert.assertFalse(versionKeyOutputMap.isEmpty());
for (String key : versionKeyOutputMap.keySet()) {
System.out.println(
"key: " + key + " value " + versionKeyOutputMap.get(key)
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method asserts that testConcurrentActiveReadWhileVersionInFlight succeeded at least once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That is what I want. This test proves that while a versioning is going on we can still read.

Comment on lines +94 to +120
GetItemResponse res = DdbHelper.getKeyStoreDdbItem(
branchKeyId,
"branch:ACTIVE",
Fixtures.TEST_KEYSTORE_NAME,
DynamoDbClient.create()
);
DdbHelper.deleteKeyStoreDdbItem(
branchKeyId,
"branch:ACTIVE",
Fixtures.TEST_KEYSTORE_NAME,
DynamoDbClient.create(),
true
);
DdbHelper.deleteKeyStoreDdbItem(
branchKeyId,
"beacon:ACTIVE",
Fixtures.TEST_KEYSTORE_NAME,
DynamoDbClient.create(),
true
);
DdbHelper.deleteKeyStoreDdbItem(
branchKeyId,
res.item().get("version").s(),
Fixtures.TEST_KEYSTORE_NAME,
DynamoDbClient.create(),
true
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous class, use DeleteBranchKey.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Do we need to do something to ensure that both tests run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +336 to +338
testLogging {
events("passed")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are running 1000 + 150 + more tests, you may not want to log every pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these concurrency tests are expensive and I don't want them to run every pr - if i have them run once a week, I don't see an issue in logging the passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants